<script type="text/javascript">
function loadFilesNumber(){
	$('.folder_id').each(function( index ) {
		var folderid= $(this).val();
		var interview_id='${interviewId}';
		${remoteFunction(
				action:'interview_files_number',
				controller:'interview',
				update: [success: 'number_files_\'+folderid+\''],
				params:'\'id=\' + interview_id + \'&folder_id=\' + folderid',
				)}
		});
}
$(document).ready(function(){
		loadFilesNumber();
	});
</script>
<div class="tree smart-form ">
	<ul>
		<li><span title="Espandi"><i class="fa fa-lg fa-folder-open "></i>Intervista &nbsp;&nbsp;</span>
			<g:if test="${folders}">
				<ul >
				<g:each in="${folders }" var="folder">
					<input class="folder_id" type="hidden" value="${folder.id}">
					<li   data-toggle="tooltip" title="Cliccca per vedere i file nella cartella">
						<span title="Espandi">
							<i  id="${folder.id}it" class="fa fa-lg fa-folder-o "></i>
								${folder.documentType }
							<span class="badge bg-color-blue"><b id="number_files_${folder.id}">0</b> files</span>
							&nbsp;&nbsp;<button type="button" class="btn btn-primary btn-sm btn-open-folder" id="add_role" onclick="show_files(${folder.id},'date');"><i class="fa fa-lg fa-folder-open-o"></i></button>
<%--							<sec:ifAnyGranted roles="ROLE_ADMIN,ROLE_AMM">--%>
							&nbsp;&nbsp;<button type="button" class="btn btn-danger btn-sm" id="add_role" onclick="folderCancelAlert(${folder.id},${interview.id });"><i class="fa fa-lg fa-trash-o"></i></button>
<%--							</sec:ifAnyGranted>	--%>
						</span>

						
					</li>
				
				</g:each>
				</ul>
				</g:if>
			</li>
		
	</ul>
</div>